<?php
session_start();
require_once '../models/Users.php';
require_once '../models/_check_admin.php';
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Administration</title>
<?php include '../admin/_meta.php';?>
</head>
<body>

	<div id="firstLine">
		<div id="top-bar">
		<?php include '_top_bar_admin.php';?>
		</div>
	</div>
	<div id="container">
		<div id="header">
			<?php include '_menu_admin.php';?>
		</div>
		<div id="center">
			<div id="menu-left">
				<?php //include '_menu_left_admin.php';?>
			</div>
			<div id="table-user">
				<div id="table">
				<!--<div id="spdh">Sản phẩm đang hot</div>-->
				<div id="table-head">
				<div id="search">
					<a href="ql_user_customer.php">Quay lại</a>
				<input type="text"  name="key" id="key" class="txt_w300_h25" value="" placeholder="Tìm kiếm email customer"/>
				<input type="submit"  name="btn_submit_tk" value="Tìm kiếm" class="btn_w80_h29" onclick ='search_customer();'/>
			</div>
				<?php
				if(isset($_GET['key']) and strlen($_GET['key'])>2) {
				$key = addslashes(htmlspecialchars(trim($_GET['key'])));
				$sql = "SELECT * FROM tbl_customer  WHERE CONCAT(email) LIKE '%$key%'
						ORDER BY email DESC";
				$rs = mysql_query($sql)or die ("show: ".mysql_error());;
				if (mysql_num_rows($rs)>0) {
						print('<table id="hor-zebra">
			<thread><tr><th>Full Name</th><th>Email</th><th>Key</th><th colspan="2">Edit</th>
			</tr>
			');
			while ($row = mysql_fetch_assoc($rs)){
				print('<tbody>
					<tr>
						<td>'.$row['f_name'].' '.$row['l_name'].'</td>
						<td>'.$row['email'].'</td>
						<td>'.$row['status'].'</td>
						<td><a href="../admin/update_customer.php?customerID='.$row['customerID'].'">Update</a></td>
					</tr>
				</tbody>');
			}
			print('</table>');
				}else echo "<br><br><br>Không rõ kết quả ! Từ khóa nhập vào phải cách nhau khoảng trắng";
						} else {
							 echo "<br><br><br>Không rõ kết quả ! Từ khóa nhập vào phải cách nhau khoảng trắng";
						}
			?>
				</div>
			</div>
		</div>
	</div>
	<div>
		<?php include '_footer_admin.php';?>
	</div>

</body>
</html>